export function throttle (fn, gaptime) {
  if (gaptime === null || gaptime === undefined) {
    gaptime = 500
  }

  let _lastTime = null
  return function () {
    let _nowTime = new Date()
    if (_nowTime - _lastTime > gaptime || !_lastTime) {
      fn()
      _lastTime = _nowTime
    }
  }
}